.TH ZRAMCTL 8 "July 2014" "util-linux" "System Administration"
.SH NAME
zramctl \- set up and control zram devices
.SH SYNOPSIS
.ad l
Get info:
.sp
.in +5
.BR zramctl " [options]"
.sp
.in -5
Reset zram:
.sp
.in +5
.B "zramctl \-r"
.IR zramdev ...
.sp
.in -5
Print name of first unused zram device:
.sp
.in +5
.B "zramctl \-f"
.sp
.in -5
Set up a zram device:
.sp
.in +5
.B zramctl
.RB [ \-f " | "\fIzramdev\fP ]
.RB [ \-s
.IR size ]
.RB [ \-t
.IR number ]
.RB [ \-a
.IR algorithm ]
.sp
.in -5
.ad b
.SH DESCRIPTION
.B zramctl
is used to quickly set up zram device parameters, to reset zram devices, and to
query the status of used zram devices.
.PP
If no option is given, all non-zero size zram devices are shown.
.PP
Note that \fIzramdev\fP node specified on command line has to already exist. The command
.B zramctl
creates a new /dev/zram<N> nodes only when \fB\-\-find\fR option specified. It's possible
(and common) that after system boot /dev/zram<N> nodes are not created yet.
.SH OPTIONS
.TP
.BR \-a , " \-\-algorithm lzo" | lz4 | lz4hc | deflate | 842
Set the compression algorithm to be used for compressing data in the zram device.
.TP
.BR \-f , " \-\-find"
Find the first unused zram device.  If a \fB\-\-size\fR argument is present, then
initialize the device.
.TP
.BR \-n , " \-\-noheadings"
Do not print a header line in status output.
.TP
.BR \-o , " \-\-output " \fIlist
Define the status output columns to be used.  If no output arrangement is
specified, then a default set is used.
Use \fB\-\-help\fP to get a list of all supported columns.
.TP
.B \-\-output\-all
Output all available columns.
.TP
.B \-\-raw
Use the raw format for status output.
.TP
.BR \-r , " \-\-reset"
Reset the options of the specified zram device(s).  Zram device settings
can be changed only after a reset.
.TP
.BR \-s , " \-\-size " \fIsize
Create a zram device of the specified \fIsize\fR.
Zram devices are aligned to memory pages; when the requested \fIsize\fR is
not a multiple of the page size, it will be rounded up to the next multiple.
When not otherwise specified, the unit of the \fIsize\fR parameter is bytes.
.IP
The \fIsize\fR argument may be followed by the multiplicative suffixes KiB (=1024),
MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB"
is optional, e.g., "K" has the same meaning as "KiB") or the suffixes
KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
.TP
.BR \-t , " \-\-streams " \fInumber
Set the maximum number of compression streams that can be used for the device.
The default is one stream.
.TP
.BR \-V , " \-\-version"
Display version information and exit.
.TP
.BR \-h , " \-\-help"
Display help text and exit.

.SH EXIT STATUS
.B zramctl
returns 0 on success, nonzero on failure.

.SH FILES
.TP
.I /dev/zram[0..N]
zram block devices

.SH EXAMPLE
The following commands set up a zram device with a size of one gigabyte
and use it as swap device.
.nf
.IP
# zramctl --find --size 1024M
/dev/zram0
# mkswap /dev/zram0
# swapon /dev/zram0
 ...
# swapoff /dev/zram0
# zramctl --reset /dev/zram0
.fi
.SH AUTHORS
.nf
Timofey Titovets <nefelim4ag@gmail.com>
Karel Zak <kzak@redhat.com>
.fi
.SH SEE ALSO
.UR http://git.\:kernel.\:org\:/cgit\:/linux\:/kernel\:/git\:/torvalds\:/linux.git\:/tree\:/Documentation\:/admin-guide\:/blockdev\:/zram.rst
Linux kernel documentation
.UE .
.SH AVAILABILITY
The zramctl command is part of the util-linux package and is available from
https://www.kernel.org/pub/linux/utils/util-linux/.
